package models;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

import flexjson.JSONSerializer;
import flexjson.transformer.DateTransformer;

import play.db.jpa.Model;

@Entity
public class ProjectVisualize extends Model {
	
	@ManyToOne
	public ProjectType projectType;
	
	public String descriptions;
	
	public String unitQuantity;
	
	public String remark;
	
	@Transient
	public long projectTypeId;
	
	@Transient
	public long pvId;
	
	@Transient
	public String text;
	
	public String getText(){
		return descriptions;
	}
	public long getPvId(){
		return id;
	}
	
	public long getProjectTypeId(){
		return projectType.id;
	}
	
	public static String toJSON(List<ProjectVisualize> projectVisualizes){
		return new JSONSerializer()    	
				.include("id", "projectTypeId", "descriptions", "unitQuantity", "remark")
				.exclude("*").serialize(projectVisualizes);
		
	}
	
	public static String toSimpleJSON(List<ProjectVisualize> projectVisualizes){
		return new JSONSerializer()    	
		.include("pvId", "text")
		.exclude("*").serialize(projectVisualizes);

}


}
